package com.tequila.bops.controller;

import com.tequila.core.service.ManagerService;
import com.tequila.domain.dto.ManagerDto;
import com.tequila.domain.entity.Manager;
import com.tequila.domain.enums.StateEnum;
import com.tequila.domain.query.ManagerQuery;
import fe.core.ApiResponse;
import fe.core.Assert;
import fe.core.exception.BizException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/manager")
public class ManagerController extends BasicController {

    @Resource
    private ManagerService managerService;


    @RequestMapping("/queryPageListByParam")
    public ApiResponse queryPageListByParam(ManagerQuery query) {
        return ApiResponse.successApiResponse().withData(managerService.queryPageListByParam(query));
    }

    @RequestMapping("/queryById")
    public ApiResponse queryById(Long id) {
        return ApiResponse.successApiResponse().withData(managerService.queryById(id));
    }

    @RequestMapping("/save")
    public ApiResponse save(Manager entity) {
        return ApiResponse.successApiResponse().withData(managerService.save(entity));
    }

    @RequestMapping("/update")
    public ApiResponse update(Manager entity) {
        return ApiResponse.successApiResponse().withData(managerService.updateSelectiveById(entity));
    }
}
